package task4;

import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class TestDemo1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String str1=in.next();
            String str2=in.next();
            int count=0;
            for (int i = 0; i <= str1.length(); i++) {
                int j=0;
                int count2=0;
                int count3=0;
                char[] chars=new char[str1.length()+str2.length()];
                while(j<i){
                    chars[j]=str1.charAt(count2);
                    j++;
                    count2++;
                }
                while (count3<str2.length()){
                    chars[j]=str2.charAt(count3);
                    j++;
                    count3++;
                }
                while (count2<str1.length()){
                    chars[j]=str1.charAt(count2);
                    j++;
                    count2++;
                }
                String ret=new String(chars);
                if(isReverse(ret)){
                    count++;
                }
            }
            System.out.println(count);
        }
    }
    public static boolean isReverse(String str){
        int left=0;
        int right=str.length()-1;
        while (left<right){
            if(str.charAt(left)!=str.charAt(right)){
                return false;
            }
            left++;
            right--;
        }
        return true;
    }
}
